package com.ef.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.ef.constant.StatusType;
import com.ef.dao.CorpClassDao;
import com.ef.domain.CorpClass;
import com.ef.domain.CorpContract;

public class CorpClassDaoImpl extends DaoImpl<CorpClass> implements CorpClassDao {

	public List<CorpClass> findByContract(CorpContract contract) {
		DetachedCriteria criterion = DetachedCriteria
				.forClass(CorpClass.class);
		criterion.createCriteria("contract").add(
				Restrictions.eq("id", contract.getId()));
	    criterion.add(Restrictions.eq("status",
					StatusType.VALID));
		return  findAllByCriteria(criterion);
 	}
}
